require File.join(File.dirname(__FILE__), 'boot')

# send mail use tls and gmail
require 'smtp_tls'
Rails::Initializer.run do |config|
  config.action_mailer.perform_deliveries  = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_charset = "utf-8"
  config.action_mailer.smtp_settings = {
    :address => "smtp.gmail.com",
    :port => 587,
    :authentication => :plain,
    :user_name => "no-reply@trikr.com",
    :password => "224006"
  }
end

my_formats = {
    :show => '%Y-%m-%d %H:%M ',
    :start_time=> '%Y-%m-%d %H:%M ',
    :end_time=> '%H:%M',
    :monthday => '%M-%d',
    :my_format_2=> '%M-%d'
}
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(my_formats)
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(my_formats)
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(my_formats)

include Globalize
Locale.set_base_language('en-US')

$KCODE ='UTF8'
#$KCODE ='u'
require 'jcode'

# uploaded file extention
FILE_EXT ={
  'jpg'    => 'img',
  'jpeg'   => 'img',
  'gif'    => 'img',
  'exe'    => 'exe',
  'msi'    => 'exe',
  'pdf'    => 'pdf',
  'psd'    => 'psd',
  'png'    => 'psd',
  'doc'    => 'doc',
  'ppt'    => 'ppt',
  'rar'    => 'rar',
  'zip'    => 'rar',
  'mp3'    => 'mp3',
  'wma'    => 'mp3',
  'avi'    => 'mp3',
  'txt'    => 'txt',
  'xls'    => 'xls'
}
#log type
TYPE_EXT = { 
  1=>'message',
  2=>'todo',
  3=>'milestone',
  4=>'writeboard',
  5=>'file',
  6=>'comment',
  7=>'time',
  8=>'todo_item'
}
TODO_PRIOR = { 
  1=>'ff0000',
  2=>'ffcc66',
  3=>'ffff66',
  4=>'cccccc'
}
#lang type
LANGTYPES = [
  ["Default Language",""],
  ["English","us-en"],
  ["简体中文","zh-cn"],
  ["繁体中文","zh-big5"],
  ["Русский","ru-ru"]
]
DEFAULT_LANG = "zh-cn"
CalendarDateSelect.format = :hyphen_ampm
LONGDATE = "%Y-%m-%d %H:%M"
#require 'iconv'
require 'chinese'
